home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / kernel / const.h < prev    next >
C/C++ Source or Header  |  1990-07-23  |  6KB  |  150 lines

  1. /* General constants used by the kernel. */
  2.  
  3. #if (CHIP == INTEL)
  4.  
  5. #define K_STACK_BYTES    512    /* how many bytes for the kernel stack */
  6.  
  7. #define INIT_PSW      0x0200    /* initial psw */
  8. #define INIT_TASK_PSW 0x1200    /* initial psw for tasks (with IOPL 1) */
  9. #define TRACEBIT       0x100    /* OR this with psw in proc[] for tracing */
  10. #define SETBITS(rp, new)    /* permits only certain bits to be set */ \
  11.     ((rp)->p_reg.psw = (rp)->p_reg.psw & ~0xCD5 | (new) & 0xCD5)
  12.  
  13. /* Initial sp for mm, fs and init.
  14.  *    2 bytes for short jump
  15.  *    2 bytes unused
  16.  *    3 words for init_org[] used by fs only
  17.  *    3 words for real mode debugger trap (actually needs 1 more)
  18.  *    3 words for save and restart temporaries
  19.  *    3 words for interrupt
  20.  * Leave no margin, to flush bugs early.
  21.  */
  22. #define INIT_SP (2 + 2 + 3 * 2 + 3 * 2 + 3 * 2 + 3 * 2)
  23.  
  24. #define HCLICK_SHIFT       4    /* log2 of HCLICK_SIZE */
  25. #define HCLICK_SIZE       16    /* hardware segment conversion magic */
  26. #if CLICK_SIZE >= HCLICK_SIZE
  27. #define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
  28. #else
  29. #define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
  30. #endif
  31. #define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
  32. #define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
  33.  
  34. #define ALIGNMENT       4    /* align large items to a multiple of this */
  35. #define VECTOR_BYTES     512    /* bytes of interrupt vectors to save */
  36. #define VEC_TABLE_SEG      0    /* segment of vector table */
  37.  
  38. /* Interrupt vectors defined/reserved by processor. */
  39. #define DIVIDE_VECTOR      0    /* divide error */
  40. #define DEBUG_VECTOR       1    /* single step (trace) */
  41. #define NMI_VECTOR         2    /* non-maskable interrupt */
  42. #define BREAKPOINT_VECTOR  3    /* software breakpoint */
  43. #define OVERFLOW_VECTOR    4    /* from INTO */
  44.  
  45. /* Fixed system call vector (the only software interrupt). */
  46. #define SYS_VECTOR        32    /* system calls are made with int SYSVEC */
  47. #define SYS386_VECTOR     33    /* except 386 system calls use this */
  48.  
  49. /* Suitable irq bases for hardware interrupts.  Reprogram the 8259(s) from
  50.  * the PC BIOS defaults since the BIOS doesn't respect all the processor's
  51.  * reserved vectors (0 to 31).
  52.  */
  53. #define BIOS_IRQ0_VEC   0x08    /* base of IRQ0-7 vectors used by BIOS */
  54. #define BIOS_IRQ8_VEC   0x70    /* base of IRQ8-15 vectors used by BIOS */
  55. #define IRQ0_VECTOR     0x28    /* more or less arbitrary, but > SYS_VECTOR */
  56. #define IRQ8_VECTOR     0x30     /* together for simplicity */
  57.  
  58. #define WINI_0_PARM_VEC 0x41    /* parameters for hard disk 1 */
  59. #define WINI_1_PARM_VEC 0x46    /* parameters for hard disk 2 */
  60.  
  61. /* Hardware interrupt numbers. */
  62. #define CLOCK_IRQ          0
  63. #define KEYBOARD_IRQ       1
  64. #define CASCADE_IRQ        2    /* cascade enable for 2nd AT controller */
  65. #define ETHER_IRQ          3    /* ethernet interrupt vector */
  66. #define SECONDARY_IRQ      3    /* RS232 interrupt vector for port 2 */
  67. #define RS232_IRQ          4    /* RS232 interrupt vector for port 1 */
  68. #define XT_WINI_IRQ        5    /* xt winchester */
  69. #define FLOPPY_IRQ         6    /* floppy disk */
  70. #define PRINTER_IRQ        7
  71. #define AT_WINI_IRQ       14    /* at winchester */
  72. #define PS_KEYB_IRQ        9    /* keyboard interrupt vector for PS/2 */
  73.  
  74. /* Hardware vector numbers. */
  75. #define CLOCK_VECTOR     ((CLOCK_IRQ & 0x07) + IRQ0_VECTOR)
  76. #define KEYBOARD_VECTOR  ((KEYBOARD_IRQ & 0x07) + IRQ0_VECTOR)
  77. #define ETHER_VECTOR     ((ETHER_IRQ & 0x07) + IRQ0_VECTOR)
  78. #define SECONDARY_VECTOR ((SECONDARY_IRQ & 0x07) + IRQ0_VECTOR)
  79. #define RS232_VECTOR     ((RS232_IRQ & 0x07) + IRQ0_VECTOR)
  80. #define XT_WINI_VECTOR   ((XT_WINI_IRQ & 0x07) + IRQ0_VECTOR)
  81. #define FLOPPY_VECTOR    ((FLOPPY_IRQ & 0x07) + IRQ0_VECTOR)
  82. #define PRINTER_VECTOR   ((PRINTER_IRQ & 0x07) + IRQ0_VECTOR)
  83. #define AT_WINI_VECTOR   ((AT_WINI_IRQ & 0x07) + IRQ8_VECTOR)
  84. #define PS_KEYB_VECTOR   ((PS_KEYB_IRQ & 0x07) + IRQ8_VECTOR)
  85.  
  86. /* 8259A interrupt controller ports. */
  87. #define INT_CTL         0x20    /* I/O port for interrupt controller */
  88. #define INT_CTLMASK     0x21    /* setting bits in this port disables ints */
  89. #define INT2_CTL        0xA0    /* I/O port for second interrupt controller */
  90. #define INT2_MASK       0xA1    /* setting bits in this port disables ints */
  91.  
  92. /* Magic numbers for interrupt controller. */
  93. #define ENABLE          0x20    /* code used to re-enable after an interrupt */
  94.  
  95. /* Sizes of memory tables. */
  96. #define NR_MEMS            4    /* number of chunks of memory */
  97.  
  98. /* Magic memory locations and sizes. */
  99. #define COLOR_BASE   0xB8000L    /* base of color video memory */
  100. #define COLOR_SIZE    0x8000L    /* maximum usable color video memory */
  101. #define MONO_BASE    0xB0000L    /* base of mono video memory */
  102. #define MONO_SIZE     0x8000L    /* maximum usable mono video memory */
  103.  
  104. /* Cursor shape is needed by debugger as well as console driver. */
  105. #define CURSOR_SHAPE      15    /* block cursor for MDA/HGC/CGA/EGA/VGA... */
  106.  
  107. /* Miscellaneous ports. */
  108. #define PCR        0x65    /* Planar Control Register */
  109. #define PORT_B          0x61    /* I/O port for 8255 port B (kbd, beeper...) */
  110. #define TIMER0          0x40    /* I/O port for timer channel 0 */
  111. #define TIMER2          0x42    /* I/O port for timer channel 2 */
  112. #define TIMER_MODE      0x43    /* I/O port for timer mode control */
  113.  
  114. #endif /* (CHIP == INTEL) */
  115.  
  116. #if (CHIP == M68000)
  117.  
  118. #define K_STACK_BYTES   1024    /* how many bytes for the kernel stack */
  119.  
  120. /* p_reg contains: d0-d7, a0-a6,   in that order. */
  121. #define NR_REGS           15    /* number of general regs in each proc slot */
  122.  
  123. #define TRACEBIT      0x8000    /* or this with psw in proc[] for tracing */
  124. #define SETBITS(rp, new)    /* permits only certain bits to be set */ \
  125.     ((rp)->p_reg.psw = (rp)->p_reg.psw & ~0xFF | (new) & 0xFF)
  126.  
  127. #define MEM_BYTES  0x1000000    /* memory size for /dev/mem */
  128. #define ALIGNMENT       4    /* align large items to a multiple of this */
  129.         /* 2 would do for an 68000, but 4 is nicer for 68020/68030 */
  130.  
  131. #ifdef ACK
  132. #define FSTRUCOPY
  133. #endif
  134.  
  135. #endif /* (CHIP == M68000) */
  136.  
  137. /* The following items pertain to the scheduling queues. */
  138. #define TASK_Q             0    /* ready tasks are scheduled via queue 0 */
  139. #define SERVER_Q           1    /* ready servers are scheduled via queue 1 */
  140. #define USER_Q             2    /* ready users are scheduled via queue 2 */
  141.  
  142. #if (MACHINE == ATARI)
  143. #define SHADOW_Q           3    /* runnable, but shadowed processes */
  144. #define NQ                 4    /* # of scheduling queues */
  145. #else
  146. #define NQ                 3    /* # of scheduling queues */
  147. #endif
  148.  
  149. #define printf        printk    /* the kernel really uses printk, not printf */
  150.